<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="$!webPath/resources/style/system/manage/$!{config.websiteCss}/template.css"  rel="stylesheet" type="text/css"/>
<link  href="$!webPath/resources/style/common/css/jquery-ui-1.8.22.custom.css" type=text/css rel=stylesheet>
<link rel="stylesheet" href="$!webPath/resources/editor/themes/default/default.css" />
<script src="$!webPath/resources/js/jquery-1.6.2.js"></script>
<script src="$!webPath/resources/js/jquery.validate.min.js"></script>
<script src="$!webPath/resources/js/jquery.shop.common.js"></script>
<script src="$!webPath/resources/js/jquery-ui-1.8.21.js"></script>
<script charset="utf-8" src="$!webPath/resources/editor/kindeditor.js"></script>
<script charset="utf-8" src="$!webPath/resources/editor/lang/zh_CN.js"></script>
<script src="$!webPath/resources/js/jquery.zh.cn.js"></script>
<script>
var options = {
        cssPath : '$!webPath/resources/editor/plugins/code/prettify.css',
        filterMode : true,
		uploadJson:'$!webPath/upload.htm',
		width : '860px',
		height:'400px',
		resizeType : 1,
		allowImageUpload : true,
		allowFlashUpload : false,
		allowMediaUpload : false,
		allowFileManager : false,
		syncType:"form",
		afterCreate : function() {
							var self = this;
							self.sync();
						},
		afterChange : function() {
							var self = this;
							self.sync();
						},
		afterBlur : function() {
							var self = this;
							self.sync();
						},
		items:['source', '|', 'fullscreen', 'undo', 'redo', 'print', 'cut', 'copy', 'paste',
			'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
			'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
			'superscript', '|', 'selectall', 'clearhtml','quickformat','|',
			'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
			'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image','table', 'hr', 'emoticons', 'link', 'unlink', '|', 'about']
}; 
jQuery(document).ready(function(){
  editor = KindEditor.create('#ig_content',options); 
  jQuery("#img1").change(function(){
     jQuery("#img_text").val(jQuery(this).val()); 
  });
  for(var i=0;i<24;i++){
    jQuery("#begin_hour").append("<option value='"+i+"'>"+i+"</option>");
	jQuery("#end_hour").append("<option value='"+i+"'>"+i+"</option>");
  }
 jQuery("#theForm").validate({
	debug:false,							   
    rules:{
	 ig_goods_name:{required:true},
	 ig_goods_price:{required:true,number:true},
	 ig_goods_integral:{required:true,digits:true},
	 ig_goods_count:{required:true,digits:true},
	 ig_limit_count:{required:true,digits:true},
	 ig_transfee:{required:true,number:true},
	 ig_begin_time:{required:true},
	 ig_end_time:{required:true}
	 #if(!$!obj),
	 img1:{
		 required:true,
	    accept:"$!config.imageSuffix"
	  }
	  #end
	 },
    messages:{
	 ig_goods_name:{required:"礼品名称不能为空"},
	 ig_goods_price:{required:"礼品价格不能为空",number:"礼品价格只能为数字"},
	 ig_goods_integral:{required:"兑换积分不能为空",digits:"兑换积分只能为整数"},
	 ig_goods_count:{required:"库存数量不能为空",digits:"库存数量只能为整数"},
	 ig_limit_count:{required:"会员兑换数量不能为空",digits:"会员兑换数量只能为整数"},
	 ig_transfee:{required:"运费不能为空",number:"运费只能为数字"},
	 ig_begin_time:{required:"开始时间不能为空"},
	 ig_end_time:{required:"结束时间不能为空"}
	 #if(!$!obj),	 
	 img1:{
		 required:"商品图片不能为空",
	    accept:"不允许的图片格式"
	  }
	  #end
	}
  });
 	//改变系统提示的样式
  jQuery("span .w").mousemove(function(){
	var id=jQuery(this.parentNode).attr("id");
	if(id="nothis"){
	   jQuery(this.parentNode).attr("id","this")
	}
  }).mouseout(function(){
     var id=jQuery(this.parentNode).attr("id");
	 if(id="this"){
	   jQuery(this.parentNode).attr("id","nothis")
	 }
  });
  //
  jQuery(":radio[id^=ig_limit_type]").click(function(){
	 var type=jQuery(this).val();
	 if(type=="true"){
	   jQuery("#ig_limit_count_info").show();
	 }else{
	   jQuery("#ig_limit_count_info").hide();
	 }
  });
  //
  jQuery(":radio[id^=ig_transfee]").click(function(){
    var type=jQuery(this).val();
	if(type=="1"){
	  jQuery("#ig_transfee_info").show();
	}else{
	  jQuery("#ig_transfee_info").hide();	
	}
  });
  //
  jQuery(":radio[id^=ig_time_type]").click(function(){
    var type=jQuery(this).val();
	if(type=="true"){
	   jQuery("div[id^=limitime_]").show();
	}else{
	   jQuery("div[id^=limitime_]").hide();
	}
  })
  //
 jQuery('#ig_begin_time').attr("readonly","readonly").datepicker({
	  dateFormat:"yy-mm-dd",
	  changeMonth: true,
	  changeYear: true
  });
  jQuery('#ig_end_time').attr("readonly","readonly").datepicker({
	  dateFormat:"yy-mm-dd",
	  changeMonth: true,
	  changeYear: true
  });
  //
  jQuery(":radio[id=ig_limit_type][value=$!obj.ig_limit_type]").attr("checked","checked");
  #if($!obj.ig_limit_type==true)
    jQuery("#ig_limit_count_info").show();
  #end
  jQuery(":radio[id=ig_transfee_type][value=$!obj.ig_transfee_type]").attr("checked","checked");
  #if($!obj.ig_transfee_type==1)
    jQuery("#ig_transfee_info").show();
  #end  
  jQuery(":radio[id=ig_time_type][value=$!obj.ig_time_type]").attr("checked","checked");
  #if($!obj.ig_time_type==true)
    jQuery("#limitime_begin").show();
	jQuery("#limitime_end").show();
  #end
  jQuery("#begin_hour").val($!CommUtil.formatTime("HH",$!obj.ig_begin_time));
  jQuery("#end_hour").val($!CommUtil.formatTime("HH",$!obj.ig_end_time));
  jQuery(":radio[id=ig_show][value=$!obj.ig_show]").attr("checked","checked");
  jQuery(":radio[id=ig_recommend][value=$!obj.ig_recommend]").attr("checked","checked");
});
</script>
</head>
<body>
<div class="cont">
  <h1 class="seth1">积分商城</h1>
 <div class="settab"><span class="tab-one"></span> <span class="tabs"> <a href="$!webPath/admin/integral_goods.htm">礼品列表</a> | <a href="$!webPath/admin/integral_goods_add.htm"  #if(!$!edit) class="this"#end>新增礼品</a> | <a href="$!webPath/admin/integral_order.htm">兑换列表</a>#if($!edit)|<a href="javascript:void(0);"class="this">编辑礼品</a>#end </span> <span class="tab-two"></span></div>
 <form action="$!webPath/admin/integral_goods_save.htm" method="post" enctype="multipart/form-data" id="theForm">
  <div class="edit">
    <div class="editul setcont">
      <h1 class="giftsh">礼品信息</h1>
      <div class="giftinfor">
      <div class="giftright">
          <ul class="set3">
            <li><strong class="orange fontsize20">*</strong>礼品名称</li>
            <li><span class="pxnum">
              <input name="ig_goods_name" type="text" id="ig_goods_name" value="$!obj.ig_goods_name" size="35" />
              </span></li>
          </ul>
          <ul class="set3">
            <li><strong class="orange fontsize20">*</strong>礼品原价</li>
            <li><span class="pxnum">
              <input name="ig_goods_price" type="text" id="ig_goods_price" value="$!obj.ig_goods_price" size="35" />
              </span></li>
          </ul>
          <ul class="set3">
            <li><strong class="orange fontsize20">*</strong>兑换积分</li>
            <li><span class="pxnum">
              <input name="ig_goods_integral" type="text" id="ig_goods_integral" value="$!obj.ig_goods_integral" size="35" />
              </span></li>
          </ul>
          <ul class="set3">
            <li><strong class="orange fontsize20">*</strong>库存</li>
            <li><span class="pxnum">
              <input name="ig_goods_count" type="text" id="ig_goods_count" value="$!obj.ig_goods_count" size="35" />
              </span></li>
          </ul>
          <ul class="set3">
            <li>礼品标签</li>
            <li><span class="pxnum">
               <input name="ig_goods_tag" type="text" id="ig_goods_tag" value="$!obj.ig_goods_tag" size="35" />
              </span></li>
          </ul>
        </div>
        <div class="giftleft">
          <div style="padding-left:10px">
            <div class="gift1"><strong class="orange fontsize20">*</strong>礼品图片</div>
            #if($!obj.ig_goods_img)
             #set($img="$!webPath/$!obj.ig_goods_img.path/$!obj.ig_goods_img.name")
            #else
             #set($img="$!webPath/resources/style/common/images/good.jpg")
            #end
            <div class="giftimg"><img src="$!img" width="204" height="204" /></div>
             <div style=" height:33px; padding-top:16px;"><span class=" size13">
             <input name="img_text" type="text" id="img_text"></span>
             <span class="filebtn"><input name="" type="button" value=""></span>
      <span style="float:left;" class="file">
      <input name="img1" type="file" size="30" id="img1"></span>
      </div>
          </div>
        </div>
        
      </div>
      <h1 class="giftsh">兑换要求</h1>
      <ul class="set3">
        <li>限制每会员兑换数量</li>
        <li class="radiosp"><span>
          <input name="ig_limit_type" id="ig_limit_type" type="radio" value="true" />
          </span><span>限制</span><span>
          <input name="ig_limit_type" type="radio" id="ig_limit_type" value="false" checked="checked" />
        </span><span>不限制</span></li>
      </ul>
      <ul class="set3" id="ig_limit_count_info" style="display:none;">
        <li>每会员兑换数量</li>
        <li><span class="pxnum">
          <input name="ig_limit_count" type="text" id="ig_limit_count" value="$!obj.ig_limit_count" size="35" />
          </span></li>
      </ul>
      <ul class="set3">
        <li>运费承担方式</li>
        <li class="radiosp"><span>
          <input name="ig_transfee_type" id="ig_transfee_type" type="radio" value="0" checked="checked" />
          </span><span>卖家</span><span>
          <input name="ig_transfee_type" id="ig_transfee_type" type="radio" value="1" />
        </span><span>买家</span></li>
      </ul>
      <ul class="set3" id="ig_transfee_info" style="display:none;">
        <li>运费价格</li>
        <li><span class="pxnum">
          <input name="ig_transfee" type="text" id="ig_transfee" value="$!CommUtil.null2Double($!{obj.ig_transfee})"   size="35"/>
          </span></li>
      </ul>
      <ul class="set3">
        <li>限制兑换时间</li>
        <li class="radiosp"> <span>
          <input name="ig_time_type" id="ig_time_type" type="radio" value="true" />
          </span><span>限制</span><span>
          <input name="ig_time_type" id="ig_time_type" type="radio" value="false" checked="checked" />
        </span><span>不限制</span> </li>
      </ul>
      <div class="limitime" id="limitime_begin" style="display:none;">
        <div class="limi_left">
          <div class="starttime">开始时间</div>
          <div class="timeset"><span class="allmen size1">
            <input name="ig_begin_time" type="text" id="ig_begin_time" value="$!CommUtil.formatShortDate($!obj.ig_begin_time)"  size="15" />
            </span><span>日</span><span class="sethour">
            <select name="begin_hour" id="begin_hour">
              
            </select>
          </span><span>时</span></div>
        </div>
        <div class="limi_right" id="limitime_end" style="display:none;">
          <div class="starttime">结束时间<span class="timeset"></span></div>
          <div class="timeset"><span class="allmen size1">
            <input name="ig_end_time" type="text" id="ig_end_time"  value="$!CommUtil.formatShortDate($!obj.ig_end_time)"  size="15"/>
            </span><span>日</span><span class="sethour">
            <select name="end_hour" id="end_hour">
             
            </select>
          </span><span>时</span></div>
        </div>
      </div>
      <h1 class="giftsh">状态设置</h1>
      <ul class="set3">
        <li>是否上架</li>
        <li class="radiosp"><span>
          <input name="ig_show" id="ig_show" type="radio" value="true" checked="checked"  />
          </span><span>是</span><span>
          <input name="ig_show" id="ig_show" type="radio" value="false" />
        </span><span>否</span> </li>
      </ul>
      <ul class="set3">
        <li>是否推荐</li>
         <li class="radiosp"> <span>
          <input name="ig_recommend" id="ig_recommend" type="radio" value="true" checked="checked"  />
          </span><span>是</span><span>
          <input name="ig_recommend" id="ig_recommend" type="radio" value="false" />
        </span><span>否</span> </li>
      </ul>
       <ul class="set3">
        <li>礼品排序</li>
        <li><span class="pxnum">
          <input name="ig_sequence" type="text" id="ig_sequence" value="$!obj.ig_sequence" size="35" />
          </span><span id="nothis"><strong class="q"></strong><strong class="w">数值越小排序越靠前</strong><strong class="c"></strong></span></li>
      </ul>
      <h1 class="giftsh">seo设置</h1>
      <ul class="set3">
        <li>SEO关键字</li>
        <li><span class="pxnum">
          <input name="ig_seo_keywords" type="text" id="ig_seo_keywords" value="$!obj.ig_seo_keywords" size="35" />
          </span></li>
      </ul>
      <ul class="set3">
        <li>SEO描述</li>
        <li><span class="pxnum txtarsize2">
          <textarea name="ig_seo_description" cols="35" rows="6" id="ig_seo_description">$!obj.ig_seo_description</textarea>
        </span></li>
      </ul>
      <h1 class="giftsh">礼品描述</h1>
      <ul class="set3">
        <li>
          <textarea name="ig_content" cols="35" rows="6" id="ig_content">$!obj.ig_content</textarea>
        </li>
      </ul>
    </div>
  </div>
  <div class="submit">
    <input name="" type="submit" value="提交" />
    <input name="id" type="hidden" id="id" value="$!obj.id" />
    <input type="hidden" name="hiddenField" id="hiddenField" />
    <input name="list_url" type="hidden" id="list_url" value="$!webPath/admin/integral_goods.htm?currentPage=$!currentPage" />
    <input name="add_url" type="hidden" id="add_url" value="$!webPath/admin/integral_goods_add.htm?currentPage=$!currentPage" />
  </div>
  </form>
</div>
</body>
</html>
